﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace TinyCinema.UI.Pages.Movie._Movies
{
    /// <summary>
    /// Interaction logic for FormView.xaml
    /// </summary>
    /// 
    public partial class FormView : Page
    {
        public FormView()
        {
            InitializeComponent();
            DataContext = Movies.dataContext;
            (DataContext as Bussiness.Movie.Movies).Messenger.Register<Bussiness.Movie.Message.BackConfimation>(this, ShowMessageBox1);
            (DataContext as Bussiness.Movie.Movies).Messenger.Register<Bussiness.Movie.Message.BackConfimationOK>(this, (s) => MainPage.pagMovies.FormViewModeHandle());
            (DataContext as Bussiness.Movie.Movies).Messenger.Register<Bussiness.Movie.Message.DeleteFailed>(this, ShowMessageBox2);
            (DataContext as Bussiness.Movie.Movies).Messenger.Register<Bussiness.Movie.Message.DeleteConfirmation>(this, ShowMessageBox3);
        }
        void ShowMessageBox1(Bussiness.Movie.Message.BackConfimation s)
        {
            s.Result = MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langMsgExit") as String), "", MessageBoxButton.YesNo);
        }
        void ShowMessageBox2(Bussiness.Movie.Message.DeleteFailed s)
        {
            MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langMsgMovieNotDelete") as String), "", MessageBoxButton.OK);
        }
        void ShowMessageBox3(Bussiness.Movie.Message.DeleteConfirmation s)
        {
            s.Result = MessageBoxUtils.WPFMessageBox.Show((App.Current.FindResource("langMsgMovieDelete") as String), "", MessageBoxButton.YesNo);
        }
    }
}
